<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/WEB-INF/jsp/hadmin/contentHeader.jsp"%>
</head>
<body class="gray-bg">
	<div class="row wrapper border-bottom white-bg page-heading">
		<div class="col-sm-12">
			<div class="bars pull-left">
				<div class="btn-group hidden-xs"
					id="512da251a878609d19d7e1c405d84ba9" role="group">
					<button onclick="addRows('512da251a878609d19d7e1c405d84ba9');"
						type="button" class="btn btn-outline btn-default">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
					</button>
					<button onclick="editRows('512da251a878609d19d7e1c405d84ba9');"
						type="button" class="btn btn-outline btn-default">
						<i class="glyphicon glyphicon-edit" aria-hidden="true"></i>
					</button>
<!-- 					<button onclick="deleteRows('512da251a878609d19d7e1c405d84ba9');"
						type="button" class="btn btn-outline btn-default">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
					</button> -->
					<button onclick="examineRows('512da251a878609d19d7e1c405d84ba9')"
						type="button" class="btn btn-outline btn-default">
						<i class=" glyphicon glyphicon-hand-up" aria-hidden="true"></i>
					</button>
					<form onsubmit="return refresh();"
						id="512da251a878609d19d7e1c405d84ba9_SearchTable" role="form"
						class="form-inline btn-group hidden-xs">

						<div class="col-md-5">
							<input placeholder="ID" class="form-control" name="nickName"
								type="text">
						</div>
						<div class="col-md-5">
							<select name="status"
								class="form-control m-b help-block m-b-none">
								<option value="">请选择用户状态</option>
								<option value="0">正常</option>
								<option value="1">待审核</option>
								<option value="2">未通过</option>
							</select>
						</div>
					</form>
				</div>
			</div>
			<h:table excludeAll="true">
				<th data-sortable="true" data-field="nickName">ID</th>
				<th data-sortable="true" data-field="name">姓名</th>
				<th data-sortable="true" data-field="sex">性别</th>
				<th data-sortable="true" data-formatter="statusFormatter"
					data-field="status">状态</th>
			</h:table>
			<%-- <%@include file="/WEB-INF/jsp/hadmin/include/table.jsp" %> --%>
		</div>
	</div>

	<script type="text/javascript">
		var tableConfig = {
			uniqueId : "nickName",
		};
		function statusFormatter(type) {
			var rt = "";
			if (type == 1) {
				rt = "<span style='color:red;'>" + $("option[value='" + type + "']").text() + "</span>";
			} else if (type == 0) {
				rt = "<span style='color:green;'>" + $("option[value='" + type + "']").text() + "</span>";
			} else if (type == 2) {
				rt = $("option[value='" + type + "']").text();
			}
			return rt;
		}
		
		function examineRows(tableID){
			tableID = "#"+tableID+"Table";
			var rows = $(tableID).bootstrapTable("getSelections");
			if(!rows || rows.length == 0){
				showDialog({
					title: "提示",
					text: "请选择要审批的数据！",
					type: "warning",
				});
			}else if(rows.length > 1 ){
				showDialog({
					title: "提示",
					text: "只能选择一条记录！",
					type: "warning",
				});
			}else{
				var config = $(tableID).bootstrapTable("getOptions");
				openDialog("examine.act?"+config.uniqueId+"="+rows[0][config.uniqueId],"审批");
			}
		}
		
	</script>
	<h:configBootstrapTable />
	<%-- <%@include file="/WEB-INF/jsp/hadmin/include/tableInit.jsp" %> --%>
</body>

</html>
